//package com.tduck.cloud.poster.controller;
//
//import cn.hutool.core.util.IdUtil;
//import cn.hutool.core.util.ObjectUtil;
//import cn.hutool.core.util.StrUtil;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.tduck.cloud.common.util.Result;
//import com.tduck.cloud.common.util.SecurityUtils;
//import com.tduck.cloud.poster.entity.PosterEntity;
//import com.tduck.cloud.poster.entity.PosterFormLinkEntity;
//import com.tduck.cloud.poster.service.PosterFormLinkService;
//import lombok.RequiredArgsConstructor;
//import org.springframework.web.bind.annotation.*;
//
//import java.io.InputStream;
//import java.util.List;
//import java.util.Map;
//
//
///**
// * 海报关联表单
// * @author : tduck
// * @since  :  2023/02/01 14:43
// **/
//@RestController
//@RequiredArgsConstructor
//@RequestMapping("/poster/")
//public class PosterFormLinkController {
//
////    private final PosterFormLinkService posterFormLinkService;
//
//    /**
//     * 查询关联列表
//     */
//    @GetMapping("form/link/list")
//    public Result<List<PosterFormLinkEntity>> list(PosterFormLinkEntity poster) {
//        LambdaQueryWrapper<PosterFormLinkEntity> queryWrapper = Wrappers.<PosterFormLinkEntity>lambdaQuery()
//                .eq(PosterFormLinkEntity::getPosterKey, poster.getPosterKey());
//        //posterFormLinkService.list(queryWrapper)
//        return Result.success();
//    }
//
//
//    /**
//     * 新增或修改海报关联
//     */
//    @PostMapping("form/link/save")
//    public Result<PosterFormLinkEntity> save(@RequestBody PosterFormLinkEntity poster) {
//        poster.setUserId(SecurityUtils.getUserId());
//        if(ObjectUtil.isNull(poster.getId())){
//            poster.setLinkKey(ShortIdUtils.genId());
//            // 是否存在
//            PosterFormLinkEntity posterFormLinkEntity = posterFormLinkService.getOne(Wrappers.<PosterFormLinkEntity>lambdaQuery()
//                    .eq(PosterFormLinkEntity::getPosterKey, poster.getPosterKey())
//                    .eq(PosterFormLinkEntity::getFormKey, poster.getFormKey()));
//            if (null != posterFormLinkEntity) {
//                return Result.failed("该表单已关联");
//            }
//        }
//        boolean save = posterFormLinkService.saveOrUpdate(poster);
//        return Result.success(poster);
//    }
//
//
//    /**
//     * 删除海报关联
//     */
//    @PostMapping("form/link/delete/{id}")
//    public Result<Boolean> delete(@PathVariable Long id) {
//        return Result.success(posterFormLinkService.removeById(id));
//    }
//
//
//    /**
//     * 生成海报
//     *
//     * @param linkKey 关联海报key
//     * @param dataId  数据id
//     * @return 海报地址
//     */
//    @PostMapping("/generate/{linkKey}/{dataId}")
//    public Result<Map<String,Object>> generate(@PathVariable("linkKey") String linkKey, @PathVariable("dataId") Long dataId) {
//        return posterFormLinkService.generate(linkKey, dataId);
//    }
//
//
//}
